import http from "@/utils/request";

/**
 * 获取菜单列表
 */
export default {
  async getMenuList(params) {
    return http.get("api/permission/list", params);
  },
  /**
   * 获取父级菜单列表
   * @param params
   * @return {AxiosPromise<any>}
   */
  async getParentMenuList() {
    return http.get("api/permission/parent/list");
  },
  /**
   * 添加菜单
   * @param params
   * @return {Promise<返回值>}
   */
  async addMenu(params) {
    return http.post("api/permission/add", params);
  },
  /**
   * 修改菜单
   * @param params
   * @return {AxiosPromise<any>}
   */
  async updateMenu(params) {
    return http.put("api/permission/update", params);
  },
  /**
   * 检测菜单权限是否存在子菜单
   * @param params
   * @return {AxiosPromise<any>}
   */
  async checkPermission(params) {
    return http.getRestApi("api/permission/check", params);
  },
  /**
   * 删除菜单
   * @param param
   * @return {AxiosPromise<any>}
   */
  async deleteMenu(param) {
    return http.delete("api/permission/delete", param);
  },
}
